package com.xz.cstone.core;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import com.xz.cstone.data.ClusterData;

import weka.core.Instances;

public class DataLoader {
	public DataLoader()
	{
		
	}
	
	public ClusterData loadArffFile(String path) {
		try {
			Instances data = new Instances(new BufferedReader(new FileReader(path)));
			data.classIndex();
			
			ClusterData sourceData = new ClusterData(data);
			return sourceData;
			
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			return null;
		} catch (IOException e) {
			e.printStackTrace();
			return null;
		}		
	}
}
